using System;
using System.Collections;
using System.Text;
using Edge.DAL.Common.ResultSet;
using NHibernate.Transform;

namespace Edge.DAL.Common.ResultSet
{
    public class ResultSetTransformer<TResult> : IResultTransformer
        where TResult : new()
    {

        ResultSetMapper<TResult> mapper;


        public ResultSetTransformer(ResultSetMapper<TResult> mapper)
        {
            if (mapper == null)
                throw new ArgumentException("mapper");

            this.mapper = mapper;
        }

        public virtual object TransformTuple(object[] tuple, string[] aliases)
        {
            return mapper.Map(aliases, tuple);
        }

        public IList TransformList(IList collection)
        {
            return collection;
        }
    }
}